package com.test1.administrator.website.entity;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.test1.administrator.website.data.MyDataBaseHelper;
import com.test1.administrator.website.util.websiteIsNullException;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/5/7.
 */

public class Website {
    int id;
    String name;
    String site;

//    public Website() {
//    }

    public Website(String name, String site) throws websiteIsNullException {
        if (name == null && site == null) {
            throw new websiteIsNullException();
        }
        this.name = name;
        this.site = site;
        if(name==null || "".equals(name)){
            name="默认网站";
        }

    }

    public String getName() {
        return name;
    }

    public String getSite() {
        return site;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setSite(String site) {
        this.site = site;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(name).append("####").append(site);
        return sb.toString();
    }

    public Map<String, String> toMap() {
        Map<String, String> mMap = new HashMap<>();
        mMap.put(name, site);
        return mMap;
    }

}
